CC = gcc
COMPILE_FLAG = -O0 -Wall 
SRC_DIRECTORY := src
BUILD_DIRECTORY := obj
INCLUDES := -I include 

LIBS = 

all: pipe_cal pipe_cmd pipe_broken_read pipe_broken_write popen_rw fifo_read fifo_write msg_send msg_recv shm_tell \
	 shm_sem shm_sem_pv pipe_progress_fan sem_file_rw

pipe_cal:
	@test -d $(BUILD_DIRECTORY) || mkdir $(BUILD_DIRECTORY)
	$(CC) -g -rdynamic $(INCLUDES)   $(COMPILE_FLAG)  -o $(BUILD_DIRECTORY)/pipe_cal $(SRC_DIRECTORY)/pipe_cal.c  $(LIBS)

pipe_cmd:
	@test -d $(BUILD_DIRECTORY) || mkdir $(BUILD_DIRECTORY)
	$(CC) -g -rdynamic $(INCLUDES)   $(COMPILE_FLAG)  -o $(BUILD_DIRECTORY)/pipe_cmd $(SRC_DIRECTORY)/pipe_cmd.c  $(LIBS)

pipe_broken_read:
	@test -d $(BUILD_DIRECTORY) || mkdir $(BUILD_DIRECTORY)
	$(CC) -g -rdynamic $(INCLUDES)   $(COMPILE_FLAG)  -o $(BUILD_DIRECTORY)/pipe_broken_read $(SRC_DIRECTORY)/pipe_broken_read.c  $(LIBS)

pipe_broken_write:
	@test -d $(BUILD_DIRECTORY) || mkdir $(BUILD_DIRECTORY)
	$(CC) -g -rdynamic $(INCLUDES)   $(COMPILE_FLAG)  -o $(BUILD_DIRECTORY)/pipe_broken_write $(SRC_DIRECTORY)/pipe_broken_write.c  $(LIBS)

popen_rw:
	@test -d $(BUILD_DIRECTORY) || mkdir $(BUILD_DIRECTORY)
	$(CC) -g -rdynamic $(INCLUDES)   $(COMPILE_FLAG)  -o $(BUILD_DIRECTORY)/popen_rw $(SRC_DIRECTORY)/popen_rw.c  $(LIBS)

fifo_read:
	@test -d $(BUILD_DIRECTORY) || mkdir $(BUILD_DIRECTORY)
	$(CC) -g -rdynamic $(INCLUDES)   $(COMPILE_FLAG)  -o $(BUILD_DIRECTORY)/fifo_read $(SRC_DIRECTORY)/fifo_read.c  $(LIBS)

fifo_write:
	@test -d $(BUILD_DIRECTORY) || mkdir $(BUILD_DIRECTORY)
	$(CC) -g -rdynamic $(INCLUDES)   $(COMPILE_FLAG)  -o $(BUILD_DIRECTORY)/fifo_write $(SRC_DIRECTORY)/fifo_write.c  $(LIBS)

msg_send:
	@test -d $(BUILD_DIRECTORY) || mkdir $(BUILD_DIRECTORY)
	$(CC) -g -rdynamic $(INCLUDES)   $(COMPILE_FLAG)  -o $(BUILD_DIRECTORY)/msg_send $(SRC_DIRECTORY)/msg_send.c  $(LIBS)	

msg_recv:
	@test -d $(BUILD_DIRECTORY) || mkdir $(BUILD_DIRECTORY)
	$(CC) -g -rdynamic $(INCLUDES)   $(COMPILE_FLAG)  -o $(BUILD_DIRECTORY)/msg_recv $(SRC_DIRECTORY)/msg_recv.c  $(LIBS)

shm_tell:
	@test -d $(BUILD_DIRECTORY) || mkdir $(BUILD_DIRECTORY)
	$(CC) -g -rdynamic $(INCLUDES)   $(COMPILE_FLAG)  -o $(BUILD_DIRECTORY)/shm_tell $(SRC_DIRECTORY)/shm_tell.c  $(LIBS)

shm_sem:
	@test -d $(BUILD_DIRECTORY) || mkdir $(BUILD_DIRECTORY)
	$(CC) -g -rdynamic $(INCLUDES)   $(COMPILE_FLAG)  -o $(BUILD_DIRECTORY)/shm_sem $(SRC_DIRECTORY)/shm_sem.c  $(LIBS)

shm_sem_pv:
	@test -d $(BUILD_DIRECTORY) || mkdir $(BUILD_DIRECTORY)
	$(CC) -g -rdynamic $(INCLUDES)   $(COMPILE_FLAG)  -o $(BUILD_DIRECTORY)/shm_sem_pv $(SRC_DIRECTORY)/shm_sem_pv.c  $(LIBS)

pipe_progress_fan:
	@test -d $(BUILD_DIRECTORY) || mkdir $(BUILD_DIRECTORY)
	$(CC) -g -rdynamic $(INCLUDES)   $(COMPILE_FLAG)  -o $(BUILD_DIRECTORY)/pipe_progress_fan $(SRC_DIRECTORY)/pipe_progress_fan.c  $(LIBS)

sem_file_rw:
	@test -d $(BUILD_DIRECTORY) || mkdir $(BUILD_DIRECTORY)
	$(CC) -g -rdynamic $(INCLUDES)   $(COMPILE_FLAG)  -o $(BUILD_DIRECTORY)/sem_file_rw $(SRC_DIRECTORY)/sem_file_rw.c   $(LIBS)

clean:
	rm -rf $(BUILD_DIRECTORY)/*